from django.urls import path
# from rest_framework_simplejwt.views import TokenObtainPairView
from .views import DailyActiveAPIView, Tokens, DailyOrderCountAPIView, NewAddUsers, UserAdmin, ShowSKU, \
    ImageModelViewSets, SKUImageView, SKU_admin_CRUD, Show_Categories_View, Show_SPUView, SPU_SpecView, PermissionModel, \
    Content_Type_View, GroupModelSet, GroupPermission, User_Model_ViewSet, Admin_PeopleGroup

# from rest_framework_jwt.views import obtain_jwt_token


urlpatterns = [
    path('authorizations/', Tokens.as_view()),
    # path('authorizations/', TokenObtainPairView.as_view()),
    # path('authorizations/', obtain_jwt_token),
    path('statistical/day_active/', DailyActiveAPIView.as_view()),
    path('statistical/day_orders/', DailyOrderCountAPIView.as_view()),
    path('statistical/day_increment/', NewAddUsers.as_view()),
    path('users/', UserAdmin.as_view()),
    # path('skus/images/', SKUImageView.as_view()),   # 使用ListAPIView完成商品信息的展示
    path('skus/simple/', ShowSKU.as_view()),
    path('skus/categories/', Show_Categories_View.as_view()),
    path('goods/simple/', Show_SPUView.as_view()),
    path('goods/<spu_id>/specs/', SPU_SpecView.as_view()),
    path('permission/content_types/', Content_Type_View.as_view()),
    path('permission/simple/', GroupPermission.as_view()),
    path('permission/groups/simple/', Admin_PeopleGroup.as_view()),
]

# 视图集路由操作
from rest_framework.routers import DefaultRouter

rouer = DefaultRouter()

rouer.register('skus/images', ImageModelViewSets, basename='skuimages')
rouer.register('skus', SKU_admin_CRUD, basename='skuinfo')
rouer.register('permission/perms', PermissionModel, basename='permission')
rouer.register('permission/groups', GroupModelSet, basename='group')
rouer.register('permission/admins', User_Model_ViewSet, basename='people_admin')


urlpatterns += rouer.urls